<?php

namespace Models;

use Phalcon\Mvc\Model\Behavior\SoftDelete;
class App extends BaseModel
{
    const DELETED = '1';

    const NOT_DELETED = '0';

    public function initialize()
    {
        $this->hasMany("id", "Models\AppUser", "appid", array('alias' => 'AppUser'));
        $this->addBehavior(new SoftDelete(
            array(
                'field' => 'del',
                'value' => App::DELETED
            )
        ));
    }


    public function notSave()
    {
        //Obtain the flash service from the DI container
        $flash = $this->getDI()->getFlash();

        //Show validation messages
        foreach ($this->getMessages() as $message) {
            $flash->error($message);
        }
    }


}